package com.wwt.springboot_vue.service.impl;

import com.wwt.springboot_vue.bean.Goods;
import com.wwt.springboot_vue.mapper.GoodsMapper;
import com.wwt.springboot_vue.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public List<Goods> findAllGoods() {
        return goodsMapper.findAllGoods();
    }

    @Override
    public List<Goods> findByLike(String query) {
        return goodsMapper.findByLike(query);
    }

    @Override
    public List<Goods> findById(int goods_id) {
        return goodsMapper.findById(goods_id);
    }

    @Override
    public void delete(int goods_id) {
        goodsMapper.delete(goods_id);
    }

    @Override
    public void add(String goods_name,
                    int goods_price,
                    int goods_number,
                    String goods_intro,
                    String goods_status,
                    int category_id,
                    String goods_img) {
        goodsMapper.add( goods_name, goods_price,goods_number, goods_intro,goods_status,category_id,goods_img);
    }

    @Override
    public void update(Goods goods) {
        goodsMapper.update(goods);
    }

    @Override
    public List<Goods> findByLimit(int start, int size) {
        return goodsMapper.findByLimit(start,size);
    }

    @Override
    public List<Goods> findByLikeLimit(String query, int start, int size) {
        return goodsMapper.findByLikeLimit(query,start,size);
    }
}
